class CreateOrderShipments < ActiveRecord::Migration
  def change
    create_table :order_shipments, :force => true do |t|
      t.references :order, :null => false
      t.references :shipping_method, :null => false
      t.references :order_shipping_address
      t.decimal    :cost, :precision => 8, :scale => 2,:null => true
      t.string     :parcel_number, :limit => 40,       :null => true
      t.timestamp  :shipped_at, :null => true
    end

    add_index :order_shipments, :order_id
    add_index :order_shipments, :shipping_method_id
    add_index :order_shipments, :order_shipping_address_id
    add_index :order_shipments, :parcel_number
  end
end
